package com.niit.beans;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author hanli
 * @date 2025/2/28
 * @description TODO
 */
public class User {

    // property 属性
    private int id;

    private List<String> address;

    public void setAddress(List<String> address) {
        this.address = address;
    }

    private Set<String> names;
    public void setNames(Set<String> names) {
        this.names = names;
    }

    private Map<String,Integer> scores;
    public void setScores(Map<String, Integer> scores) {
        this.scores = scores;
    }

    // User 依赖
    private Dept dept;
    public void setDept(Dept dept) {
        System.out.println("set方法被执行");
        this.dept = dept;
    }

    public void  teamwork(){
        dept.teambuilding();
        for (String name : names) {
            System.out.println(name);
        }
        System.out.println("---------names set over-----------");
        for (String address : address) {
            System.out.println(address);
        }
        System.out.println("---------address List over-----------");
        Set<String> ketSet = scores.keySet();
        for(String key : ketSet){
            System.out.println(key + ":" + scores.get(key));
        }
        System.out.println("---------scores Map keySet over-----------");
        for(Map.Entry<String,Integer> entry: scores.entrySet()){
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }
        System.out.println("---------scores Map Entery over-----------");
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    // 构造方法/构造函数  constructor
    public User(){
        System.out.println("User实例被创建");
    }

    public User(int id){
        this.id = id;
        System.out.println("User实例被创建");
    }

    public void say(){
        System.out.println("hello");
    }
}